package com.huawei.appgallery.forum.cards.card;

import android.content.Context;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.LinearLayout.LayoutParams;
import android.widget.TextView;
import com.huawei.appgallery.forum.base.card.ForumCard;
import com.huawei.appgallery.forum.cards.bean.ForumHotSpotCardBean;
import com.huawei.appgallery.forum.posts.api.IPostDetailProtocol;
import com.huawei.appgallery.foundation.ui.framework.cardkit.bean.CardBean;
import o.azb;
import o.bsy.c;
import o.bsy.e;
import o.cgz;
import o.chy;
import o.eqx;
import o.evx;
import o.fho;
import o.fiu;
import o.fjb;

public class ForumHotSpotLiteCard extends ForumCard implements OnClickListener {
    private ForumHotSpotCardBean ʻ;
    private ImageView ˊ;
    private LinearLayout ˋ;
    private TextView ˎ;
    private Context ˏ;
    private TextView ॱ;
    private FrameLayout ॱॱ;

    public ForumHotSpotLiteCard(Context context) {
        super(context);
        this.ˏ = context;
    }

    public cgz ˏ(View view) {
        ʽ(view);
        this.ˋ = (LinearLayout) view.findViewById(c.ˍ);
        this.ˋ.setOnClickListener(this);
        this.ˊ = (ImageView) view.findViewById(c.ˎˎ);
        this.ˎ = (TextView) view.findViewById(c.ˋᐝ);
        this.ॱ = (TextView) view.findViewById(c.ˋˋ);
        this.ॱॱ = (FrameLayout) view.findViewById(c.ˏˎ);
        if (this.ˏ.getResources().getConfiguration().orientation == 2) {
            this.ˎ.setMaxLines(1);
            this.ॱ.setMaxLines(1);
        }
        return this;
    }

    public void ˏ(CardBean cardBean) {
        super.ˏ(cardBean);
        if (cardBean instanceof ForumHotSpotCardBean) {
            this.ʻ = (ForumHotSpotCardBean) cardBean;
            ˎ(this.ʻ);
            ˊ(this.ˎ, this.ʻ.ʽ());
            ˊ(this.ॱ, this.ʻ.ʻ());
            ʽ();
        }
    }

    private void ʽ() {
        LayoutParams layoutParams = (LayoutParams) this.ॱॱ.getLayoutParams();
        layoutParams.topMargin = this.ˏ.getResources().getDimensionPixelOffset(e.ʼ);
        this.ॱॱ.setLayoutParams(layoutParams);
    }

    private void ˎ(ForumHotSpotCardBean forumHotSpotCardBean) {
        String ʼ = forumHotSpotCardBean.ʼ();
        int ॱ = (azb.ॱ(this.ˏ) - ˎ()) / ʼ();
        this.ˊ.setLayoutParams(new LayoutParams(ॱ, (int) (((double) ॱ) / 1.7777777777777777d)));
        this.ˊ.setTag(forumHotSpotCardBean);
        eqx.ˏ(this.ˊ, ʼ, "image_default_icon");
    }

    protected int ˎ() {
        return (azb.ˊ(this.ˏ) + azb.ˏ(this.ˏ)) + ((ʼ() - 1) * this.ˊˋ.getResources().getDimensionPixelSize(e.ॱˎ));
    }

    protected int ʼ() {
        return ˊ() ? 2 : 1;
    }

    private void ʻ() {
        fjb ˎ = fho.ˏ().ˋ("Posts").ˎ("post.detail.activity");
        IPostDetailProtocol iPostDetailProtocol = (IPostDetailProtocol) ˎ.ˊ();
        iPostDetailProtocol.setDomainId(this.ʻ.ॱ());
        iPostDetailProtocol.setUri(this.ʻ.ॱॱ());
        fiu.ˊ().ˏ(this.ˏ, ˎ);
    }

    public void ॱ(final chy o_chy) {
        OnClickListener anonymousClass4 = new evx(this) {
            final /* synthetic */ ForumHotSpotLiteCard ॱ;

            public void ˋ(View view) {
                o_chy.ˏ(0, this.ॱ);
            }
        };
        View ˉ = ˉ();
        if (ˉ != null) {
            ˉ.setOnClickListener(anonymousClass4);
        }
    }

    public void onClick(View view) {
        if (view.getId() == this.ˋ.getId()) {
            ʻ();
        }
    }
}
